/*
 * Exploder
 * 
 * Tero Pyylampi (218437), Jussi Tuurinkoski (211594)
 *
 * MainEngine, which manages the screen switching from scene to scene
 * using possible fancy transition effects like fade in / out
 */

#ifndef MAINENGINE_H
#define MAINENGINE_H

#include "cocos2d.h"

class LuaInterface;
class UserData;

// different scenes
enum Scene {
	SCENE_SPLASH,
	SCENE_MENU,
	SCENE_GAME,
	SCENE_EDITOR,
	SCENE_INVALID
};

// main screen selector
class MainEngine
{
public:
	// default constructor
	MainEngine();
	// default destructor
	~MainEngine();

	// initializes the splash screen
	void initializeSplashScene();

	// current scene finished execution, let this engine decide what to do
	void sceneFinishedExecution();
	// current scene finished execution and suggests the next scene to be loaded
	void sceneFinishedExecution( cocos2d::CCScene *newScene, Scene sceneType );

	// pause event from the main engine (eg. incoming call)
	void applicationPaused();
	// resume event from the main engine
	void applicationResumed();

	// restart whole application 
	void restartApplication();

	// get lua implementation
	LuaInterface *getLuaInterface();
	// get saved user data
	UserData *getUserData();

private:
	// current scene & scene type
	cocos2d::CCScene *mCurrentScene;
	Scene mCurrentSceneType;

	// start the specific scene
	void initializeScene( cocos2d::CCScene *scene );
	// start the specific scene using a transition effect
	void initializeSceneUsingTransition( cocos2d::CCScene *scene );

	// different interfaces
	LuaInterface *mLuaInterface;
	UserData *mUserData;
};

#endif
